package com.andatsoft.laisim.view;

import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.andatsoft.laisim.R;

public class SmallWidgetFragment extends BaseWidgetFragment {

	private TextView mTvTitle;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.widget_layout_small_preview,
				container, false);
		mViewBackground = view.findViewById(R.id.layout_widget_small_preview);
		mTvTitle = (TextView) view.findViewById(R.id.widget_small_tv_title_preview);
		return view;
	}

	public void updateTextViewBoldItalic(boolean isBold, boolean isItalic) {
		if (mTvTitle != null) {
			if (isBold && isItalic) {
				mTvTitle.setTypeface(null, Typeface.BOLD_ITALIC);
			} else {
				if (isBold) {
					mTvTitle.setTypeface(null, Typeface.BOLD);
				} else if (isItalic) {
					mTvTitle.setTypeface(null, Typeface.ITALIC);
				} else {
					mTvTitle.setTypeface(null,Typeface.NORMAL);
				}
			}
		}
	}

	public void updateTextViewColor(int color) {
		if (mTvTitle != null)
			mTvTitle.setTextColor(color);

	}

	public void updateTextView(boolean isBold, boolean isItalic, int color) {
		if (mTvTitle != null) {
			updateTextViewBoldItalic(isBold, isItalic);
			mTvTitle.setTextColor(color);
		}
	}
}
